const HtmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const path = require('path')
module.exports = {
    entry:{
        bundle:'./src/main.js',
        vendor:'vue'
        },
    output:{
        path:path.resolve(__dirname,'../dist'),
        filename:'js/[name].js'
    },
    module:{
        rules:[
            {
                test: /\.js$/, 
                exclude: /node_modules/, 
                use: 'eslint-loader'
            },
            {
                test: /\.vue$/, 
                loader: 'vue-loader' 
            },
            {
                test: /.js$/,
                use: {
                  loader: 'babel-loader',
                  options: {
                    presets: ['@babel/preset-env']
                  },
                },
                exclude:/node_modules/
              },
            {
                test:/\.css$/,
                use: [
                    'style-loader',
                    'css-loader',
                  ]
            },
            {
                test:/\.less$/,
                use: [
                    'style-loader',
                    'css-loader',
                    'less-loader'
                  ]
            }, 
            {
                test: /\.(png|jpe?g|gif)$/,
                use: {
                  loader: 'file-loader',
                  options: {
                    outputPath: 'image',
                    name: '[name].[ext]'
                  }
                }
              },

        ]
    },
    plugins:[
        new HtmlWebpackPlugin({
            title:'乐引的2-2作业',
            template:'./public/index.html'
        }),
        new VueLoaderPlugin()
    ]
}